package com.wenwei.view;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.wenwei.parking.R;

/**
 * Created by Administrator on 2017/8/22.
 */
public class AdminOptDialog extends Dialog {
    public AdminOptDialog(Context context) {
        super(context);
    }

    public AdminOptDialog(Context context, int themeResId) {
        super(context, themeResId);
    }

    protected AdminOptDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    public interface DelDialogEvent{

        void onDelete();//确定删除

        void onCancel();//取消
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.custom_admin_dia);
        setCanceledOnTouchOutside(false);
        initView();
        initEvent();
    }

    private TextView numTv;
    private TextView mOkTv;
    private TextView   mCancelTv;

     private void initView() {
        mOkTv = (TextView) findViewById(R.id.del_dialog_ok);
        mCancelTv = (TextView) findViewById(R.id.del_dialog_cancel);
        numTv = (TextView) findViewById(R.id.parking_num);
    }

    private void initEvent() {
        mOkTv .setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(mCallBack!=null){
                    mCallBack.onDelete();
                }
            }
        });

        mCancelTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(mCallBack!=null){
                    mCallBack.onCancel();
                }
            }
        });
    }
    private DelDialogEvent mCallBack;
    public void setDelDialogEvent(DelDialogEvent event){
        mCallBack = event;
    }
}
